package com.lill.common.component.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class StreamUtil {
	
	public static String inputStream2String(InputStream is){
		ByteArrayOutputStream baos = null;
		String resultString=null;
		try {
			baos = new ByteArrayOutputStream();
			int i = -1;
			while ((i = is.read()) != -1) {
				baos.write(i);
			}
			resultString=baos.toString();
		} catch (Exception e) {
		}finally{
			try {
				if(is!=null) is.close();
			} catch (IOException e) {
			}
			try {
				if(baos!=null) baos.close();
			} catch (IOException e) {
			}
		}
		
		return resultString;
	}
}
